

--_VERSION = '0.17.1',

local ngx = ngx;
local require = require;

local log     = require("modules.commhm.log");
local ns_time = require("modules.commhm.time");
local uu      = require("modules.commhm.utils");

local FOO = {
	_VERSION   = '0.12.1',
};

---在worker启动后马上加载
FOO.safe_load = function( modules_name_ )
	ns_time.start();
	uu.set_init_protect_mode()   ---加载期保护模式
	local init_ = require( modules_name_ )
	local ret_msg_
	if  init_ then
		ret_msg_ = "succ"
	else
		ret_msg_ = "fail"
	end
	---只能打印文件日志，初始化阶段无法调用ngx.say
	log.day_list_simple( "worker_init", "safe_load", ngx.worker.id(),
			"init_by_worker", modules_name_, ret_msg_, ns_time.get_all_cost() )

	return init_
end

return FOO
